Dialect Definitions for: 1.2.1
Show:

Web API Phrases

Web API Configures the Yadda parser with phrases that support operations on HTTP APIs

Methods

Disable HTTP GZIP compression

()

Disable HTTP GZIP compression

I disable gzip

Example:

GIVEN I disable gzip

Disable HTTP keep alive

()

Disable HTTP keep-alive

I disable keep-alive

Example:

GIVEN I disable keep-alive

Enable HTTP GZIP compression

()

Enable HTTP GZIP compression

I enable gzip

Example:

GIVEN I enable gzip

Enable HTTP keep alive

()

Enable HTTP keep-alive

I enable keep-alive

Example:

GIVEN I enable keep-alive

Extract variable from a JSON response

(
  • path
  • name
)

Extra a value from the (JSON) body and store as a scoped variable

I store body path $path as $name

Parameters:

  • path String
    • JSON Path to extract variable
  • name String
    • scoped variable to store result

Example:

I store body path $.access_token as access-token

Extract variable from an HTTP header

(
  • header
  • name
)

Extract avalue from HTTP header and store as a scoped variable

I store header $header as $name

Parameters:

  • header String
    • name of header to extract
  • name String
    • scoped variable to store result

Example:

I store header ApiKey as client_id

Send HTTP DELETE request

(
  • resource
)

Issue an HTTP DELETE request to default target or an absolute URL. The @target annotation is used to select a target

I DELETE $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I DELETE /
I DELETE http://example.com

Send HTTP GET request

(
  • resource
)

Issue an HTTP GET request to default target or an absolute URL. The @target annotation is used to select a target

I GET $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I GET /
I GET http://example.com

Send HTTP HEAD request

(
  • resource
)

Issue an HTTP HEAD request to default target or an absolute URL. The @target annotation is used to select a target

I request HEAD for $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I request HEAD for /
I request HEAD for http://example.com

Send HTTP PATCH request

(
  • resource
)

Issue an HTTP PATCH request to default target or an absolute URL. The @target annotation is used to select a target

I PATCH $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I PATCH /
I PATCH http://example.com

Send HTTP POST request

(
  • resource
)

Issue an HTTP POST request to default target or an absolute URL. The @target annotation is used to select a target

I POST $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I POST /
I POST http://example.com

Send HTTP PUT request

(
  • resource
)

Issue an HTTP PUT request to default target or an absolute URL. The @target annotation is used to select a target

I PUT $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I PUT /
I PUT http://example.com

Send request for HTTP OPTIONS

(
  • resource
)

Issue an HTTP POST request to default target or an absolute URL. The @target annotation is used to select a target

I request OPTIONS for $resource

Parameters:

  • resource String
    • target resource path or full URL

Example:

I request OPTIONS for /
I request OPTIONS for  http://example.com

Set access_token

(
  • token
)

Set an OAUTH access_token both as scoped variable for use in subsequent requests. The $path parameter is a JSON path used to access the (non-standard) access_token from the current HTTP response.

I store body path $path as access token

Parameters:

  • token String
    • valid oauth access token

Example:

I store body path $.access_token as access token

Set HTTP Request Header

(
  • name
  • varname
)

Set an HTTP Header from a variable

 I set $header header from $varname

Parameters:

  • name String
    • header name
  • varname String
    • a scoped variable name

Example:

 I set test = 123
 I set header x-my-header from test

Set HTTP Request Header

(
  • name
  • value
)

Set an HTTP Header to a value

 I set $header header to $value

 I set header $header = $value

Parameters:

  • name String
    • header name
  • value String
    • header value

Example:

 I set header Accept to application/json

Set HTTP Request Parameter

(
  • name
  • value
)

Add an HTTP Query Parameter to the Request

 I set parameter $key to $value

 I set $key parameter to $value

 I set $key param to $value

 I set param $key to $value

Parameters:

  • name String
    • query parameter name
  • value String
    • query parameter value

Example:

 I set parameter api_key to ABCD1234

Set HTTP response

(
  • payload
)

Set HTTP response to payload. Objects are sent as JSON, everything else as BODY text.

I set body to $payload

Parameters:

  • payload String
    • JSON or text payload

Example:

I set body to hello world

Set HTTP response

(
  • payload
)

Set HTTP response to CSV payload.

I set body to CSV:
------------
$CSV
------------

I send CSV:
------------
$CSV
------------

Parameters:

  • payload String
    • JSON or text payload

Example:

I set body to CSV:
------------
what, who
hello, world
------------

Set HTTP response

(
  • payload
)

Set HTTP response to JSON payload.

I set body to JSON:
------------
$JSON
------------

I send JSON:
------------
$JSON
------------

Parameters:

  • payload String
    • JSON or text payload

Example:

I set body to JSON:
------------
{ "what": "hello", "who": "world" }
------------

Set HTTP response

(
  • payload
)

Set HTTP response to JSON payload.

I set body to JSON:
------------
$JSON
------------

I send JSON:
------------
$JSON
------------

Parameters:

  • payload String
    • JSON or text payload

Example:

I set body to JSON:
------------
{ "what": "hello", "who": "world" }
------------

Set HTTP response

(
  • text
)

Set HTTP response to raw (text) payload.

I set body to:
------------
$TEXT
------------

I send:
------------
$TEXT
------------

Parameters:

  • text String

    payload

Example:

I set body to:
------------
Hello World
------------

Set HTTP timeout

(
  • timeout
)

Set a named HTTP timeout to a time in milliseconds

I set request timeout to $time

Parameters:

  • timeout String
    • duration in milliseconds

Example:

GIVEN I set request timeout to 3000

Set named cookies

(
  • name
  • value
)

Set a named HTTP cookie to value

I set cookie $cookie to $value

I set cookie $cookie = $value

Parameters:

  • name String
    • cookie name
  • value String
    • cookie value

Example:

I set cookie my-tag = abc-1234

Use Client Certificate

(
  • cert
)

Add a client certificate to an HTTP request. The certificate itself is defined in the config.json file.

 I use a $CERT client certificate

 I use an $CERT client certificate

Parameters:

  • cert String
    • certificate name

Example:

 I use a valid client certificate

Use Client Credentials to authenticate

(
  • agent
)

Use OAUTH flow to authenticate using a named agent

 I use OAuth2 credentials as $agent

 I use oauth credentials as $agent

 I use client-credentials as $agent

Parameters:

  • agent String
    • named agent

Example:

 I use client-credentials as default

Use Client Credentials to authenticate as default agent

()

Use OAUTH flow to authenticate using default agent

 I use OAuth2

 I use oauth

Example:

 I use oauth